<?php
/**
 * Template Name: Blog
 *
 * A custom page template for portfolio page.
 *
 * The "Template Name:" bit above allows this to be selectable
 * from a dropdown menu on the edit page screen.
 *
 * @package WordPress
 * @subpackage Sastro
 * @since Sastro 1.0
 */

get_header(); ?>
		<?php
        $shortname = THE_SHORTNAME;
        $initial = THE_INITIAL;
        
        
        $pid = nvr_get_postid();
        $custom = nvr_get_customdata($pid);
        $cat = (isset($custom["blog_category"][0]))? $custom["blog_category"][0] : "";
        $bloglayout = (isset($custom["blog_layout"][0]))? $custom["blog_layout"][0] : "";
        $bloginfscrolls = (isset($custom["blog_infscrolls"][0]))? $custom["blog_infscrolls"][0] : "";
        if($bloginfscrolls=='true' && $bloglayout!='classic'){
            $bloginfscrolls = '1';
        }else{
            $bloginfscrolls = '0';
        }
        
        global $post, $more, $nvr_blogparam;
        $more = 0;
        
        $nvr_blogparam = array(
            'bloglayout' => $bloglayout,
            'infscrolls' => $bloginfscrolls
        );
        
        $argquery = array(
            'post_type' => 'post',
            'paged' => $paged
        );
        if($cat!=''){
            $argquery['category_name'] = $cat;
        }
        query_posts($argquery); 
        
        /* Run the loop to output the posts.
        * If you want to overload this in a child theme then include a file
        * called loop-index.php and that will be used instead.
        */
        get_template_part( 'loop', 'index' );
        ?>
<?php get_footer(); ?>